from flask import Flask, render_template, request, redirect, url_for
from exts import db
from models import UserModel
from blueprints.auth import bp as auth_bp
from blueprints.qa import bp as qa_bp
from flask_migrate import Migrate

import config

app = Flask(__name__)
# 绑定配置文件，以后所有的配置都放在config.py中
# app.config.from_pyfile("config.py")
app.config.from_object(config)
# 将db与app绑定
db.init_app(app)
migrate = Migrate(app, db)

# 注册蓝图
app.register_blueprint(auth_bp)
app.register_blueprint(qa_bp)

@app.route("/")
def index():
  return render_template("index.html")

if __name__ == "__main__":
  app.run(debug=True, host="0.0.0.0", port=9000)